class Solution {
public:
    bool check(int left,int right,string& s)
    {
        while(left<=right && s[left]==s[right])
        {
            left++,right--;
        }
        return left>right;
    }
    bool validPalindrome(string s) {
        int left=0,right=s.size()-1;
        while(left<=right && s[left]==s[right])
        {
            left++,right--;
        }
        if(left>right)
            return true;
        if(left<=right && (check(left+1,right,s)|| check(left,right-1,s)))
            return true;
        return false;
    }
};
